import { defineStore } from 'pinia'

// 卡信息
export const useCardStore = defineStore('card', {
	state: () => ({ 
		cardInfo:{ }
	}),
	actions: {
		SetCardInfo(data) {
			this.cardInfo = data
			uni.setStorageSync('cardInfo', data)
		},
		GetCardInfo() { 
			return uni.getStorageSync('cardInfo') 
		}
	},
	persist: {
		// enabled: true ,// 网页端配置 persist: true,  表示开启持久化保存（sessionSto...） 此小程序不兼容
		storage: {
		    getItem(key) {
		        return uni.getStorageSync(key)
		    },
		    setItem(key, value) {
		        uni.setStorageSync(key, value)
		    },
		}, 
	}
})